package com.cheng.im.client.protoBuilder;


import com.cheng.im.client.session.ClientSession;
import com.cheng.im.common.bean.msg.ProtoMsgV1;

/**
 * 基础 Builder
 *
 * @author 尼恩 at  疯狂创客圈
 */
public class BaseBuilder
{
    protected ProtoMsgV1.HeadType type;
    private long seqId;
    private ClientSession session;

    public BaseBuilder(ProtoMsgV1.HeadType type, ClientSession session)
    {
        this.type = type;
        this.session = session;
    }

    /**
     * 构建消息 基础部分
     */
    public ProtoMsgV1.Message buildCommon(long seqId)
    {
        this.seqId = seqId;

        ProtoMsgV1.Message.Builder mb =
                ProtoMsgV1.Message
                        .newBuilder()
                        .setType(type)
                        .setSessionId(session.getSessionId())
                        .setSequence(seqId)
                        .setAppId("11111");
        return mb.buildPartial();
    }

}
